var ns;

    ns = window.Foresight.Util;
var app = new Vue({
        el: '#app',
        data: {
            ID: 0, 
            price:'', 
            form: {
                active:0,
            },
            statusList: [
                { ID: 1, Title: '退款申请' },
                { ID: 2, Title: '退货中' },
                { ID: 3, Title: '退货完成' },
                { ID: 4, Title: '退款中' },
                { ID: 5, Title: '退款失败' },
                { ID: 6, Title: '退货中' },
                { ID: 7, Title: '退货完成' },
                { ID: 8, Title: '退款中' },
            ],
            list: [
                { ID: 1, status: 1, content: '第三方资金平台退款失败。原因：账户余额不足。', StatusValue: '退款失败', psUserName: '李文静', psPhone: '17812345678', time: '2022-10-01 12:12:43' },
                { ID: 2, status: 2, content: '退款已提交第三方资金管理平台，等待处理。', StatusValue: '退款中', psUserName: '李文静', psPhone: '17812345678', time: '2022-10-01 12:12:42' },
                { ID: 3, status: 3, content: '', StatusValue: '退货完成', psUserName: '刘伟', psPhone: '18112345678', time: '2022-10-01 12:12:43' },
                { ID: 2, status: 4, content: '买家正在退货', StatusValue: '退货中', psUserName: '李文静', psPhone: '17812345678', time: '2022-10-01 12:12:42' },
                { ID: 3, status: 5, content: '', StatusValue: '售后申请', psUserName: '刘伟', psPhone: '18112345678', time: '2022-10-01 12:12:43' },

            ],
            imglist: [
                { "ID": 31, "imgurl": "http://demo.saasyy.com/upload/Mall/20200904/132436805497550143.jpg" },
                { "ID": 32, "imgurl": "http://demo.saasyy.com/upload/Mall/20200904/132436805188771042.png" },
                { "ID": 16, "imgurl": "http://demo.saasyy.com/upload/Mall/20200904/132436804327823737.jpg" },
            ],
        },
        methods: {   
            get_data: function () {
                var that = this;
                ns.post({
                   action: 'getaftersalelist',
                   OrderID: that.ID,
                }, function (succeed, data, err) {
                    console.log(JSON.stringify(err));
                    console.log(JSON.stringify(data));
                   if (succeed) {
                       if(data.status){
                           that.form.active=data.data.active;
                           that.price=data.data.price;
                           that.list=data.data.aftersalestepinfo;
                           that.statusList=data.data.aftersalestep;

                       }else{
                        api.toast({
                            msg: '操作失败',
                            duration: 2000,
                            location: 'bottom'
                        });
                       }

                   }else {
                        api.toast({
                            msg: err,
                            duration: 2000,
                            location: 'bottom'
                        });
                   }
                });
            },
            telPhone: function (telPhone) {
                var that = this;
                if (!telPhone || telPhone == undefined) {
                    ns.toast('电话号码为空');
                    return;
                }
                ns.openWin('tel:' + telPhone);
                return;
            },
            //图片预览
            img_browser: function (url) {
                var that = this;
                var imglist = [];
                for (var i = 0; i < that.imglist.length; i++) {
                    imglist.push(that.imglist[i].imgurl);
                }
                wx.previewImage({
                    current: url,
                    urls: imglist
                });
            },
            
        }
    });
    apiready = function() {
        api.parseTapmode();
        ns = window.Foresight.Util;
        app.ID = api.pageParam.id;
        app.get_data();

    };

    
   
